package containerlogistik.implementation;

import static containerlogistik.implementation.Values.*;
import containerlogistik.interfaces.*;
import java.util.List;

public final class Entities implements Entity {
    
    public static final StowageLocation ZERO_LOC = stowageLocation(0, 0, 0);
    public static final Pallet ZERO_PALLET = pallet(ZERO_MASS, ZERO_BOUNDINGBOX);
    // Defaults
    public static final StowageLocation DEAULT_EUR_LOC = nullLocation();
    public static final Pallet DEFAULT_EUR_PALLET = pallet(DEFAULT_EUR_PALLET_MASS, 
            DEFAULT_ISO20FT_CONTAINER_BOUNDINGBOX); // Default Euro-Palle
    
    // Conainer Factories ------------------------------------------------------
    /**
     * Creates an empty 20ft container
     * @return Container 20ft empty container
     */
    public static Container container() {
        return ContainerImpl.valueOf(ZERO_MASS, 
                DEFAULT_ISO20FT_CONTAINER_EMPTY_MASS, 
                DEFAULT_ISO20FT_CONTAINER_MAX_MASS, 
                DEFAULT_ISO20FT_CONTAINER_BOUNDINGBOX);
    }
    
    /**
     * Creates an specific 20ft container
     * @param mass
     * @return 
     */
    public static Container container(Mass mass) {
        return ContainerImpl.valueOf(mass, 
                DEFAULT_ISO20FT_CONTAINER_EMPTY_MASS, 
                DEFAULT_ISO20FT_CONTAINER_MAX_MASS, 
                DEFAULT_ISO20FT_CONTAINER_BOUNDINGBOX);
    }
    
    public static Container nullContainer() {
        return NullContainer.valueOf(DEFAULT_ISO20FT_CONTAINER_BOUNDINGBOX);
    }
    
    public static Container nonContainer() {
        return NonContainer.valueOf(DEFAULT_ISO20FT_CONTAINER_BOUNDINGBOX);
    }
    
    // Pallet Factories --------------------------------------------------------
    public static Pallet pallet(Mass mass, BoundingBox boundingBox) {
        return PalletImpl.valueOf(mass, boundingBox);
    }
    
    public static Pallet nullPallet() {
        return NullPallet.valueOf(DEFAULT_EUR_PALLET_BOUNDINGBOX);
    }
    
    // StowageLocation Factories -----------------------------------------------
    public static StowageLocation containerStowage(int bays, int rows, int tiers) {
        return StowageLocationImpl.valueOf(bays, rows, tiers);
    }
    
    public static StowageLocation palletsStowage() {
        return StowageLocationImpl.valueOf(1, 9, 3);
    }
    
    public static StowageLocation stowageLocation(int bays, int rows, int tiers) {
        return StowageLocationImpl.valueOf(bays, rows, tiers);
    }
    
    public static StowageLocation nullLocation() {
        return NullLoc.valueOf();
    }
    
    // ContainerShip Factories -------------------------------------------------
    public static ContainerShip containerShip(Mass mass, Mass emptyMass, Mass maxMass, BoundingBox boundingBox, Length pos, Power power, Power maxPower, Level level) {
        return KaiserWilhelmClassShipImpl.valueOf(mass, emptyMass, maxMass, boundingBox, pos, power, maxPower, level);
    }

    // Track Factories ---------------------------------------------------------
    public static Track track(String name, List sections, String backgroundPicture) {
        return TrackImpl.valueOf(name, sections, backgroundPicture);
    }
    
}
